<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>一把手网络服务大厅-中国睢宁门户网站群</title>
<meta name="keywords" content="一把手网络服务大厅,睢宁一把手网络服务大厅"></meta>
<meta name="description" content="中国睢宁一把手网络服务大厅,睢宁一把手网络服务大厅"></meta>
<link rel="stylesheet" href="css/ybscss.css"/>
<script type="text/javascript" src="js/jquery-1.8.2.js"></script>
<script type="text/javascript" src="js/sngov.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function() { 
	var options = {
     beforeSubmit:  toSubmit,  // pre-submit callback
     success:       showResponse,  // post-submit callback
     dataType: 'json',
     //clearForm: true        // clear all form fields after successful submit
     //resetForm: true        // reset the form after successful submit
     timeout:   5000,
     error:	errorFun
 };
 $('#registerForm').ajaxForm(options);
}); 

function showResponse(responseText, statusText)  {
	changeImg();
	if(""!=responseText.msgs[0]){
		alert(responseText.msgs[0]);
	}
	
	if(responseText.isRedirect && ""!=responseText.redirect){
		window.location.href = responseText.redirect;
	}
}
function toSubmit(){
	var loginName = $("#loginName").val();
	if(""==loginName){
		alert("请输入账号！");
		return false;
	}
	var regLoginName = /^[a-zA-Z]\w{5,}$/;
	if(!regLoginName.test(loginName)){
		alert("请输入正确的账号！");
		return false;
	}
	
	var loginPwd = $("#loginPwd").val();
	if(""==loginPwd){
		alert("请输入密码！");
		return false;
	}
	
	var loginPwd2 = $("#loginPwd2").val();
	if(""==loginPwd2){
		alert("请输入验证密码！");
		return false;
	}
	
	if(loginPwd!=loginPwd2){
		alert("两次密码输入不一样！");
		return false;
	}
	
	var email = $("#email").val();
	if(""==email){
		alert("请输入邮箱！");
		return false;
	}
	var regEmail = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	if(!regEmail.test(email)){
		alert("请输入正确的邮箱！");
		return false;
	}
	var verifyCode = $("#verifyCode").val();
	if(""==verifyCode){
		alert("请输入验证码！");
		return false;
	}
	
	if($("#jsxy").attr("checked")!="checked"){
		alert("请接受一把手网络服务厅《使用协议》！");
		return false;
	}
	
	return true;
}
function errorFun(){
}

function changeImg(){
	$("#imgCode").attr("src",'<s:url action="vCode" namespace="/" />?r='+Math.random());
}
</script>
</head>

<body style=" background:url(images/zcbg.jpg) no-repeat center top;">
	<form id="registerForm" action='<s:url action="register" namespace="/" />' method="post">
    <div style=" width:1003px; margin:auto;">
   	  <div style=" height:39px; font-size:1px;"></div>
		<div class="zc1" style=" height:20px; line-height:20px;">
            <table width="100%" height="20" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td>&nbsp;</td>
                <td width="65" style=" color:#666;">已有账号？</td>
                <td width="67"><a href="login.jsp"><img src="images/ksdl.jpg"  /></a> </td>
              </tr>
            </table>
		</div>
        <div style=" height:150px; font-size:1px;"></div>
        <div class="zc2" style=" height:270px; width:470px; margin:0px 0px 0px 175px;">
        	<table width="100%" height="270" border="0" cellspacing="0" cellpadding="0">
			 <tr>
                <td width="49" style=" text-align:right; color:#787878; padding-right:10px;">账号</td>
                <td colspan="3"><input id="loginName" name="loginName" type="text" class="zcsr1" /></td>
                <td width="14"><img src="images/zcsj.jpg" /></td>
                <td width="206" style=" color:#787878;">请输入账号(以字母开头不小于6位)</td>
              </tr>
              <tr>
                <td style=" text-align:right; color:#787878;padding-right:10px;">密码</td>
                <td colspan="3"><input id="loginPwd" name="loginPwd" type="password" class="zcsr1" /></td>
                <td><img src="images/zcsj.jpg" /></td>
                <td style=" color:#787878;">请输入密码</td>
              </tr>
              <tr>
                <td style=" text-align:right; color:#787878;padding-right:10px;">验证密码</td>
                <td colspan="3"><input id="loginPwd2" name="loginPwd2" type="password" class="zcsr1" /></td>
                <td><img src="images/zcsj.jpg" /></td>
                <td style=" color:#787878;">请重复输入密码</td>
              </tr>
			  <tr>
                <td width="49" style=" text-align:right; color:#787878; padding-right:10px;">邮箱</td>
                <td colspan="3"><input id="email" name="email" type="text" class="zcsr1" /></td>
                <td width="14"><img src="images/zcsj.jpg" /></td>
                <td width="206" style=" color:#787878;">请填写您的常用邮箱</td>
              </tr>
              <tr>
                <td style=" text-align:right; color:#787878;padding-right:10px;">验证码</td>
                <td width="81"><input id="verifyCode" name="verifyCode" type="text" class="zcsr1" style=" width:73px; background:url(images/zcyzsr.jpg) no-repeat;" /></td>
                <td width="62"><img id="imgCode" src="<s:url action="vCode" namespace="/" />" onclick="changeImg()"/></td>
                <td width="48" style="text-align:center;"><span style="cursor:pointer;color:#FF4B4B;" onclick="changeImg()">换一张</span></td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td style=" text-align:right; color:#787878;"><input id="jsxy" name="jsxy" type="checkbox" value="" /></td>
                <td colspan="5" style=" color:#787878;">我接受一把手网络服务厅<span style=" color:#FF4B4B;">《使用协议》</span></td>
              </tr>
              <tr>
                <td colspan="6"><input name="ljzc" type="submit" value="" style=" width:146px; height:35px; background:url(images/ljzc.jpg) no-repeat; border:0px; margin-left:50px;cursor: pointer;" /></td>
              </tr>
            </table>

        </div>
    </div>
</form>
</body>
</html>
